<?php
$cateId = Yii::$app->request->get('cateId', '');
$type = Yii::$app->request->get('type', '');
?>
<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>

<div class="span10" id="datacontent">
    <ul class="breadcrumb">
        <li><a href="/test/question/index">测评题目</a> <span class="divider">/</span></li>
        <li style="float: right"><a href="/test/question/add">添加题目</a></li>
    </ul>

    <h4>题目列表</h4>

    <form action="<?php echo baseUrl ?>/test/question/index" method="get" class="form-horizontal">
        <table class="table">
            <tr>
                <td>
                    所属试卷：
                </td>
                <td>
                    <select name="cate_id" id="">
                        <option></option>
                        <?php foreach ($cate as $k => $v): ?>
                            <option <?php echo $cateId == $v['id'] ? "selected=selected" : "" ?> value="<?php echo $v['id'] ?>"><?php echo $v['name'] ?></option>
                        <?php endforeach ?>
                    </select>
                </td>
                <td>
                    科目：
                </td>
                <td>
                    <select name="type" id="">
                        <option></option>
                        <?php foreach ($subject as $k => $v): ?>
                            <option <?php echo $type == $v['type'] ? "selected=selected" : "" ?> value="<?php echo $v['type'] ?>"><?php echo $v['name'] ?></option>
                        <?php endforeach ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <button class="btn btn-primary" type="submit">提交</button>
                </td>
            </tr>
        </table>
    </form>
    <form action=" " id="checkPush" method="post">
        <table class="table table-hover">
            <thead>
            <tr>
                <th width="80">ID</th>
                <th>试卷</th>
                <th>科目</th>
                <th>题号</th>
                <th>题目</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <?php
            foreach ($data['data'] as $v) {
                ?>
                <tr>
                    <td><span><?php echo $v['id'] ?></span></td>
                    <td><span><?php switch ($v['cateId']) {
                                case 1:
                                    echo 'mini';
                                    break;
                                case 7:
                                    echo '初级';
                                    break;
                                case 12:
                                    echo '中级';
                                    break;
                                case 17:
                                    echo '高级';
                                    break;
                                default:
                                   echo '口语';
                            } ?></span></td>
                    <td><span><?php echo $v['cateName']?></span></td>
                    <td><span><?php echo $v['name'] ?></span></td>
                    <td><span><?php echo $v['question'] ?></span></td>
                    <td><span><?php echo date('Y-m-d',$v['createTime']) ?></span></td>
                    <td>
                        <div>
                            <a class="btn"
                               href="<?php echo baseUrl ?>/test/question/add?id=<?php echo $v['id'] ?>">修改</a>
                            <a class="btn" href="<?php echo baseUrl ?>/test/question/detail?pid=<?php echo $v['id'] ?>">详情</a>
                        </div>
                    </td>
                </tr>

                <?php
            }
            ?>
            </tbody>
        </table>
        <div class="control-group">
            <div class="controls">
            </div>
        </div>
        <input type="hidden" name="url" value="<?php echo Yii::$app->request->getUrl() ?>"/>
    </form>
    <div class="pagination pagination-right">
        <?php use yii\widgets\LinkPager; ?>
        <?php echo LinkPager::widget([
            'pagination' => $data['pageStr'],
        ]) ?>
    </div>
</div>
<script>

</script>